package com.sekill.miaosha.mq;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;


@Service
public class MQSender {

	private static Logger log = LoggerFactory.getLogger(MQSender.class);

	@Autowired
	private AmqpTemplate amqpTemplate;

	@Autowired
	private RabbitTemplate rabbitTemplate;
	
	public void sendSeckillMessage(SeckillMessage mm) {
		HashMap message = new HashMap();
		message.put("user",mm.getUserid());
		message.put("skuid",mm.getSkuid());

		amqpTemplate.convertAndSend(MQConfig.MIAOSHA_QUEUE,message);
	}

}
